Key assignments and generated codes